import { Entity, Column, Index } from 'typeorm';
import { BaseEntity } from '../../base/entity/base';

/**
 * 会员等级
 */
@Entity('member_grade')
export class MemberGradeEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '等级名称' })
  gradeName: string;

  @Column({ comment: '所需积分', default: 0 })
  requiredScore: number;

  @Column({ comment: '等级图标', nullable: true })
  gradeIcon: string;

  @Column({
    comment: '折扣率',
    type: 'decimal',
    precision: 5,
    scale: 2,
    default: 100,
  })
  discountRate: number;

  @Column({ comment: '专属特权说明', type: 'text', nullable: true })
  privilegeDescription: string;

  @Column({ comment: '等级状态', dict: ['停用', '启用'], default: 1 })
  status: number;
}
